#!/usr/bin python
from plugins.config.config_package import *


class Weblogic(object):
    def check_weblogic_console(url):
        path = 'console/login/LoginForm.jsp'
        res = core.get(url,path)
        if res.status_code == 200:
            core.checksuc(target=url,name='Weblogic Admin Console',payload='console/login/LoginForm.jsp')
        else:
            pass

    def check_cve_2014_4210(url):
        path = 'uddiexplorer/SearchPublicRegistries.jsp'
        res = core.get(url,path)
        if res.status_code == 200:
            core.checksuc(target=url,name='CVE-2014-4210 Weblogic SSRF',payload='uddiexplorer/SearchPublicRegistries.jsp')
        else:
            pass
    
    def check_CVE_2018_2894(url):
        path = 'ws_utc/resources/setting/options/general'
        res = core.get(url,path)
        if res.status_code != 404 and 'Webloginc' in res.text:
            core.checksuc(target=url,name='Weblogic JAVA deserialization CVE-2018-289',payload='ws_utc/resources/setting/options/general')     
        else:
            pass